package com.example.jg.model;

import com.example.jg.base.BaseModel;
import com.example.jg.bean.HotBean;
import com.example.jg.not.ApiServcie;
import com.example.jg.not.HttpUlist;
import com.example.jg.not.RxUlist;

import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;

public class HotModel extends BaseModel {
    public void Hotdata(final HotCallBack callBack){
        ApiServcie apiServer = new HttpUlist().getApiServer(ApiServcie.url, ApiServcie.class);
        apiServer.getdata().compose(RxUlist.<HotBean>RobservableTransformer())
                .subscribe(new Observer<HotBean>() {
                    @Override
                    public void onSubscribe(Disposable d) {

                    }

                    @Override
                    public void onNext(HotBean hotBean) {
                        callBack.onSuccess(hotBean);
                    }

                    @Override
                    public void onError(Throwable e) {
                        callBack.onFali(e.getMessage());
                    }

                    @Override
                    public void onComplete() {

                    }
                });
    }
}
